草庐IT

c++: 捕获 runtime_error

全部标签

c# - MVC 全局错误处理 : Application_Error not firing

我正在尝试在我的MVC应用程序中实现全局错误处理。我的Application_Error中有一些逻辑重定向到ErrorController但它不起作用。我在Global.aspx的Application_Error方法中有一个断点。当我强制异常时,断点没有被击中。有什么想法吗? 最佳答案 您可以尝试使用这种方法进行测试:protectedvoidApplication_Error(objectsender,EventArgse){varerror=Server.GetLastError();Server.ClearError();R

c# - 在代码中使用 '"using"关键字时,我应该在哪里捕获异常?

哪个在结构上更好?classProgram{staticvoidMain(string[]args){try{using(Foof=newFoo()){//somecommandsthatpotentiallyproduceexceptions.}}catch(Exceptionex){Console.WriteLine(ex.Message);}}}或者...classProgram{staticvoidMain(string[]args){using(Foof=newFoo()){try{//somecommandsthatpotentiallyproduceexceptions.

c# - Visual Studio 变得疯狂 : 'The directory name is invalid' error when trying to compile

出于一些非常奇怪的原因,我的VisualStudio2008在尝试编译C#项目时尝试将可执行文件的输出写入与可执行文件同名的目录,至少看起来这就是错误所在消息暗示。在我的任何项目上运行编译后,CSC.EXE报告以下编译器错误:Couldnotwritetooutputfile'D:\Projects\Examples\StringBuilderVsString\obj\Release\StringBuilderVsString.exe'--'Thedirectorynameisinvalid.'当我查看obj\Release或obj\Debug时,所有中间资源(如StringBuild

c# - 如何在托管 C++ 中捕获非托管 C++ 异常

我正在一个大型非托管C++库和一个大型C#库上开发一个瘦托管C++包装器。我需要捕获源自大型非托管C++库的错误,并将它们作为Clr异常重新抛出。非托管库抛出以下类的实例:Error::Error(conststd::string&file,longline,conststd::string&function,conststd::string&message){message_=boost::shared_ptr(newstd::string(format(file,line,function,message)));}constchar*Error::what()constthrow(

c# - 当子控件具有焦点时在窗体上捕获 KeyUp 事件

我需要在我的表单中捕获KeyUp事件(以切换“全屏模式”)。这是我正在做的:protectedoverridevoidOnKeyUp(KeyEventArgse){base.OnKeyUp(e);if(e.KeyCode==Keys.F12)this.ToggleFullScreen();}privatevoidToggleFullScreen(){//Snazzycodegoeshere}这很好用,除非窗体上的控件具有焦点。在那种情况下,我根本没有收到该事件(也尝试过OnKeyDown-也没有运气)。我可以处理来自子控件的KeyUp事件,但窗体上的控件是动态生成的,并且可能有很多-每

c# - 绘制图像时 : System. Runtime.InteropServices.ExternalException: GDI 中发生一般性错误

我有一个从Panel创建的全局图形对象。每隔一定时间从磁盘中拾取图像并使用Graphics.DrawImage()绘制到面板中。它在几次迭代中工作正常,然后我得到以下有用的异常:System.Runtime.InteropServices.ExternalException:AgenericerroroccurredinGDI+.atSystem.Drawing.Graphics.CheckErrorStatus(Int32status)atSystem.Drawing.Graphics.DrawImage(Imageimage,Int32x,Int32y)atSystem.Drawi

c# - 无法从传输连接读取数据 : The connection was closed error in console application

我在控制台应用程序中有这段代码,它在一个循环中运行try{HttpWebRequestrequest=(HttpWebRequest)WebRequest.Create(search);request.Headers.Add("Accept-Language","de-DE");request.Method="GET";request.Accept="text/html";using(HttpWebResponseresponse=(HttpWebResponse)request.GetResponse()){using(StreamReaderreader=newStreamRead

c# - 如何使用 C# 和 WebKit.NET 捕获完整的网站屏幕截图?

我正在使用WebKit.NET在我的C#应用程序中集成浏览器组件。问题是我只能用屏幕截图捕获浏览器窗口中的可见部分。有没有办法捕获整个页面的屏幕截图? 最佳答案 似乎可以通过使用NativeMethods.SendMessage来实现,尽管这会搞砸消息队列,您可以使用http://cutycapt.sourceforge.net/吗?或者也许http://iecapt.sourceforge.net/或http://labs.awesomium.com/capturing-web-pages-with-c-net/?

c# - MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(3243,9) : error MSB4094

在VSUltimate201312.0.21005.1REL中打开我的VSUltimate2012C#解决方案后,我收到以下警告:Warning1Foundconflictsbetweendifferentversionsofthesamedependentassembly.Pleasesetthe"AutoGenerateBindingRedirects"propertytotrueintheprojectfile.Formoreinformation,seehttp://go.microsoft.com/fwlink/?LinkId=294190.EnergyMS我遵循Micros

c# - 在 C# Windows 窗体应用程序中捕获 Ctrl + Shift + P 击键

这个问题在这里已经有了答案:关闭11年前。PossibleDuplicate:CapturecombinationkeyeventinaWindowsFormsapplication我需要在按下(Ctrl+Shift+P)键时执行特定操作。我怎样才能在我的C#中捕获它?申请?